﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.ComponentModel;
using EMC;

namespace Admin_Client
{
    public class User : INotifyPropertyChanged
    {
        public String username;
        public String password;
        public String firstname;
        public String lastname;
        public String level;
        public String email;
        public String phone;
        public String whoAmI;
        public bool sucess;
       


        public User()
        {

        }
        public void CreateUser(string userid, string firstname, string lastname, string password, string level, string email)
        {

//          databaseConfiguration config = new databaseConfiguration(@"G:\01-UniSem2-2011\CP2013\CP2011\Assigment\Source Code\sauna-d\sourcecode\Admin_Client\bin\Debug\" + @"db_settings.xml");
            databaseConfiguration config = new databaseConfiguration(@"db_settings.xml");
            UserManagement userManagement = new UserManagement(AdminClientControler.config);

            userManagement.adduser(userid, firstname, lastname, password, level, email);

        }

        public void DeleteUser(string userid)
        
        {

            databaseConfiguration config = new databaseConfiguration(@"db_settings.xml");
            UserManagement userManagement = new UserManagement(AdminClientControler.config);

            userManagement.delUser(userid);
        
        }

        public void EditUser(string userid, string firstname, string lastname, string password, string level, string email, string phone, string whoAmI) 
        {

            databaseConfiguration config = new databaseConfiguration(@"db_settings.xml");
            UserManagement userManagement = new UserManagement(AdminClientControler.config);

            userManagement.editUser(userid, firstname, lastname, password, level, email, phone, whoAmI);
        
        }

        public List<string> ListUsers()
        {
            UserManagement userManagement = new UserManagement(AdminClientControler.config);

            return userManagement.ListUsers();

        }
    

        public string FirstName
        {
            get { return firstname; }
            set
            {
                firstname = value;
            }
        }

        public string LastName
        {
            get { return lastname; }
            set
            {
                lastname = value;
            }
        }

        public string UserName
        {
            get { return username; }
            set
            {
                username = value;
            }
        }

        public string Password
        {
            get { return password; }
            set
            {
                password = value;
            }
        }

        public string Level
        {
            get { return level; }
            set
            {
                level = value;
            }
        }

        public string Email
        {
            get { return email; }
            set
            {
                email = value;
            }
        }

        public string Phone
        {
            get { return phone; }
            set
            {
                phone = value;
            }
        }


        public event PropertyChangedEventHandler PropertyChanged;
    }
}
